<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        html,body{
            width: 100%;
        }
        .subject{ 
            width: 800px;
            margin: 100px auto;
        }
        p{
            font-size: 20px;
            height: 30px;
        }
    </style>
</head>

<body>
    <div class="subject">

    </div>
</body>

</html>
<script>
    function ajax(method,url,Cat) {
        var xhr = new XMLHttpRequest()
        xhr.open('get', url)
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4) {
                Cat(JSON.parse(xhr.responseText))
            }
        }
        xhr.send()
    }
    ajax('get','./作业2.json',function(data){
        var str = data.list.map((item)=>{
            return `<p>${item.li}</p>`
        }).join('')
        document.querySelector('.subject').innerHTML = str
    })
</script>